<template>
  <configForm :configs="createForm" rawKey="clue_id" :info="info" :server="transferClue" :beforeSubmit="beforeSubmit" />
</template>

<script setup lang="jsx">
import { ref } from 'vue'
import ConfigForm from '@/components/CRUD/ConfigForm.vue'
import { transferClue } from '@/api/clue'
import OrganizationDialog from '@/components/Organization/OrganizationDialog.vue'

const props = defineProps({
  info: {
    type: Object,
    required: true,
  },
})
const createForm = ref([
  {
    label: '公司',
    key: 'company_name',
    type: 'custom',
    render: () => <span>{props.info.company_name}</span>,
  },
  {
    label: '小区',
    key: 'community_name',
    type: 'custom',
    render: () => <span>{props.info.community_name}</span>,
  },
  {
    label: '跟进人',
    required: true,
    key: 'to_user',
    type: 'custom',
    props: { type: 'user', placeholder: '请选择跟进人', },
    render: OrganizationDialog,
  },
])
const beforeSubmit = (params) => {
  const newParams = {
    clue_id_list: [props.info.clue_id],
    to_user_id: params.to_user.user_id,
  }
  return newParams
}
</script>